/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sysdance.aplicativo.visao.tela;

import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import org.sysdance.aplicativo.visao.operacoes.OpCurso;

/**
 *
 * @author gocard
 */
public class TelaPrincipal extends javax.swing.JFrame {
    
    /** Variavéis **/
    
    OpCurso opCurso;

    /**
     * Creates new form TelaPrincipal
     */
    public TelaPrincipal() {
        initComponents();
        this.setVisible(true);
        this.setTitle("SysDance - Sistema de Gestão Escola Dança:");
        this.setExtendedState(MAXIMIZED_BOTH);  
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menuBar = new javax.swing.JMenuBar();
        mnArquivo = new javax.swing.JMenu();
        miTrocarUsuario = new javax.swing.JMenuItem();
        miSair = new javax.swing.JMenuItem();
        mnCadastro = new javax.swing.JMenu();
        miCadastroCurso = new javax.swing.JMenuItem();
        mnMovimentacoes = new javax.swing.JMenu();
        mnAjudaSobre = new javax.swing.JMenu();
        miSobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        mnArquivo.setMnemonic('f');
        mnArquivo.setText("Arquivo");
        mnArquivo.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        miTrocarUsuario.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        miTrocarUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/login.png"))); // NOI18N
        miTrocarUsuario.setMnemonic('a');
        miTrocarUsuario.setText("Trocar usuário");
        mnArquivo.add(miTrocarUsuario);

        miSair.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        miSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/cancel.png"))); // NOI18N
        miSair.setMnemonic('x');
        miSair.setText("Sair");
        miSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miSairActionPerformed(evt);
            }
        });
        mnArquivo.add(miSair);

        menuBar.add(mnArquivo);

        mnCadastro.setMnemonic('e');
        mnCadastro.setText("Cadastro");
        mnCadastro.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        miCadastroCurso.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        miCadastroCurso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/menu.png"))); // NOI18N
        miCadastroCurso.setMnemonic('d');
        miCadastroCurso.setText("Curso");
        miCadastroCurso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miCadastroCursoActionPerformed(evt);
            }
        });
        mnCadastro.add(miCadastroCurso);

        menuBar.add(mnCadastro);

        mnMovimentacoes.setText("Movimentações");
        mnMovimentacoes.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        menuBar.add(mnMovimentacoes);

        mnAjudaSobre.setMnemonic('h');
        mnAjudaSobre.setText("Ajuda");
        mnAjudaSobre.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        miSobre.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        miSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sysdance/aplicativo/imagens/ajuda.png"))); // NOI18N
        miSobre.setMnemonic('a');
        miSobre.setText("Sobre");
        mnAjudaSobre.add(miSobre);

        menuBar.add(mnAjudaSobre);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 278, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void miSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miSairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_miSairActionPerformed

    private void miCadastroCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miCadastroCursoActionPerformed
        // TODO add your handling code here:
        
       if ((opCurso == null) || (!opCurso.isVisible())){ 
            opCurso = new OpCurso(this, true);
            opCurso.setLocationRelativeTo(this);
            opCurso.setVisible(true);
        }  
        
        
    }//GEN-LAST:event_miCadastroCursoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem miCadastroCurso;
    private javax.swing.JMenuItem miSair;
    private javax.swing.JMenuItem miSobre;
    private javax.swing.JMenuItem miTrocarUsuario;
    private javax.swing.JMenu mnAjudaSobre;
    private javax.swing.JMenu mnArquivo;
    private javax.swing.JMenu mnCadastro;
    private javax.swing.JMenu mnMovimentacoes;
    // End of variables declaration//GEN-END:variables

}
